﻿@page "/en/5.8/modules/mod-auto-control"
@{
    Layout = "_ArticleLayout";
    ViewBag.Title = "Automatic Control Module";
}

<nav class="doc-toc">
    <div class="h6">On this page</div>
    <hr>
    <ul>
        <li><a href="#overview">Overview</a></li>
        <li><a href="#installation">Installation</a></li>
        <li><a href="#variables">Variables of Telecontrol Commands</a></li>
    </ul>
</nav>

<div class="doc-content">
    <h1>Automatic Control Module</h1>
    <h2 id="overview">Overview</h2>
    <p>Automatic Control Module automatically sends commands depending on certain conditions. Unless you register the module, it works in the demo mode. The duration of a full functional demo is limited to 10 minutes after restart. The module operates under control of the Server application. The form shown below is designed to configure the module.</p>
    <figure class="figure">
        <img src="mod-auto-control-files/mod_auto_control_en.png" class="figure-img img-fluid" alt="The module configuration form" />
    </figure>
    <p>Conditions required for sending commands specified as triggers of several types:</p>
    <ul>
        <li>Channel data trigger. The trigger fires if value or status of the input channel satisfies the condition.</li>
        <li>Channel data change trigger. The trigger fires every time when value or status of an input channel changes.</li>
        <li>Event trigger. The trigger fires if an event satisfies the condition occurs.</li>
        <li>Time trigger. The trigger fires on the specified dates and times.</li>
        <li>Command trigger. The trigger fires if the Server application receives the specified command.</li>
    </ul>
    <p>Each trigger contains a set of commands which are sent if the trigger fires. The information about firing of the triggers is accessible on the <em>Log</em> page or directly from the ModAutoControl.log file. This file is located in the Server logs directory C:\SCADA\ScadaServer\Log</p>

    <h2 id="installation">Installation</h2>
    <p>Automatic Control Module is installed in accordance with <a href="../installation-and-run/module-installation#modules">the general sequence of installing Server modules</a>. The module library file is ModAutoControl.dll. By adding the module, perform the following additional actions:</p>
    <ol>
        <li>After activating the module, upload the project to the server in order to determine the computer code for module registration.</li>
        <li>Select the module on the <em>Modules</em> page and click the <em>Properties</em> button to open the module settings form.</li>
        <li>Go to the <em>Registration</em> page and register the module using the hyperlinks on the form.</li>
        <li>Configure the module by creating triggers and commands.</li>
        <li>Save the module configuration and upload the project to the server.</li>
    </ol>

    <h2 id="variables">Variables of Telecontrol Commands</h2>
    <p>String data of telecontrol command, which are send on trigger firing, can contain variables. Variables are written in braces.</p>
    <p>The following variables are supported:</p>
    <table class="table table-hover">
        <thead>
            <tr>
                <th>Variable</th>
                <th>Description</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>{n}</td>
                <td>The current value of the input channel n with a unit, where n is a channel number, n = 0 is the channel specified in the data trigger</td>
            </tr>
            <tr>
                <td>{Now}</td>
                <td>The current date and time on the server</td>
            </tr>
            <tr>
                <td>{CnlNum}, {CnlName}</td>
                <td>Parameters of the data trigger: input channel number and name</td>
            </tr>
            <tr>
                <td>{CnlVal}, {CnlStat}</td>
                <td>Value and status of the input channel those caused the trigger firing</td>
            </tr>
            <tr>
                <td>{EvNum}, {EvTime}, {EvObj}, {EvDev}, {EvCnl}, {EvText}</td>
                <td>Parameters of the event that caused the trigger firing: number, date and time, object, device, channel and description</td>
            </tr>
            <tr>
                <td>{CtrlCnlNum}, {CtrlCnlName}</td>
                <td>Parameters of the command trigger: output channel number and name</td>
            </tr>
            <tr>
                <td>{CmdVal}, {CmdDataStr}, {CmdDataHex}</td>
                <td>Parameters of the command that caused the trigger firing: value, data as a string, data in hexadecimal representation</td>
            </tr>
        </tbody>
    </table>
</div>
